package methodOnde;

import java.util.Scanner;

public class Login {
    public static void main(String[] args) {

        String name="admin";
        String password="1234";
        Scanner scanner=new Scanner(System.in);
        for(int i=0;i<3;i++){
            System.out.println("请输入姓名：");
            String names = scanner.nextLine();
            System.out.println("请输入密码：");
            String pwd=scanner.nextLine();
            if(name.equals(names)&&password.equals(pwd)){
                System.out.println("登录成功");
                break;
            }else {
               if(i==2){
                   System.out.println("今天三次输入密码错误，请明天再来！");
                   break;
               }else {
                   System.out.println("密码错误，你还有"+(2-i)+"机会");
               }
            }

        }


    }
}
